package org.example.controller.bi;

import jakarta.annotation.Resource;
import org.example.domain.Result;
import org.example.domain.bi.IoTypes;
import org.example.domain.user.Users;
import org.example.mapper.IoTypesMapper;
import org.example.utils.ThreadLocalUtil;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @description:
 * @Author: whopxx
 * @CreateTime: 2025-01-06
 */
@RestController
@RequestMapping("/ioTypes")
public class IoTypesController {

    @Resource
    private IoTypesMapper ioTypesMapper;

    /**
     * 获取所有io类型
     *
     * @return
     */
    @GetMapping("/list")
    public Result list() {
        return Result.success(ioTypesMapper.selectList(null));
    }

    @PostMapping
    public Result add(@RequestBody IoTypes ioTypes) {
        ioTypesMapper.insert(ioTypes);
        return Result.success();
    }


    @PutMapping
    public Result update(@RequestBody IoTypes ioTypes) {
        ioTypesMapper.updateById(ioTypes);
        return Result.success();
    }

    @DeleteMapping
    public Result delete(@RequestParam Integer id) {
        ioTypesMapper.deleteById(id);
        return Result.success();
    }

}
